package com.example.config;

import com.example.quartz.MyQuartz;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QuartzConfig {

    //定义工作明细
    @Bean
    public JobDetail printJobDetail(){
        return JobBuilder.newJob(MyQuartz.class).storeDurably().build();
    }

    //定义触发器
//    @Bean
//    public Trigger printTrigger(){
//        //任务执行规则
//        CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule("0/10 * * * * ?");
//        return TriggerBuilder.newTrigger()
//                .forJob(printJobDetail())
//                .withSchedule(cronScheduleBuilder)
//                .build();
//    }
}
